package suncertify;

public class Launch {

	private final static String SERVER_MODE_FLAG = "server";
	private final static String STANDALONE_MODE_FLAG = "alone";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		if(args.length == 0){
			System.out.println("Starting networked client...");
		} else if (args.length == 1){
			if(args[0].equals(SERVER_MODE_FLAG)){
				System.out.println("Starting server...");
			} else if (args[0].equals(STANDALONE_MODE_FLAG)){
				System.out.println("Starting standalone client...");
			} else {
				usage("Invalid parameter!");
			}
		} else {
			usage("Wrong number of arguments.");
		}

	}

	private static void usage(String msg) {
		System.err.println(msg + "\n");
	    System.err.println(
	    		"Usage: java -jar runme.jar [mode]\n\n" +
	    		"MODE VALUES:\n" +
	    		"server\t - to run in server mode.\n" +
	    		"\t Usage: \"java -jar runme.jar server\"\n\n" +
	    		"alone\t - to run in standalone mode (no network mode).\n" +
	    		"\t Usage: \"java -jar runme.jar alone\"\n\n" +
	    		"* If no mode is specified, the network client mode will be selected by default.\n" +
	    		"\t Usage: \"java -jar runme.jar\"\n");
	    System.exit(1);
	}

}
